import { combineReducers, createStore } from 'redux';
import CollapsedReducers from './reducers/CollapsedReducers';
import LoadingReducers from './reducers/LoadingReducers';
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage' // defaults to localStorage for web


const reducer = combineReducers({
    CollapsedReducers,
    LoadingReducers
})

const persistConfig = {
    key: 'root',
    storage,
    // BLACKLIST
    blacklist: ['LoadingReducers'],// navigation will not be persisted
}

const persistedReducer = persistReducer(persistConfig, reducer)

const store = createStore(persistedReducer);
const persistor = persistStore(store)

export { store, persistor }